package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "9021000138606058";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCbmBN5PTD/QKrPU868aMiGbor04/0xANCLWH3T2ccWqs1+45a+mu5FWW55Zjn9/Ey565LsgjJwUhtCqdFRu5k6OKnMMDlNzU+7OcJitzVffbA0YPfmpiOBGHhaRaSALuGLzGO1h7zDerrFLgs/13WTBM7SfS3CBFtYBkJHSz2grV1yp3hpIhTifTJ6oOlR0xoeI2hGzsPiWd5vFPRexENbxA6vt61NruRxqR50Ra5pEq1GWZ+040R6QCZ32N6E1i7xqzLGwmA17EcOKAxvZEi2plPo0HU/hQIvr5+HCke9HKe+55i6PPPKOgiLb99a9s7xI3xdBv4WGf5OM7wRl5qtAgMBAAECggEAGvOErAOFcTFqZO9HaCteUKrlNvYm7U4O0ZRKd1/JtItxfQE/I1UC4NBU6oJimTQStkGv+Xez9PDD+BAiSd4M9KDMCKpxwqBFp1Ch8yd4/0luNCR3zGQK0lnCvyBBFlMIjoag3tjcQaAIqg8Hs89Gdmjmyl8Uhf7rM5wh7ueBjUszLmS25PH0CTSC73Fxc/vQ3hHSI2JCk9PVw2gItMVWDPFMW8Hu59bsMoUR8Fr3JNpbGm0gKt9yiik0g3BcubDrhxksuWzpjh86j26459NUaFMMifPFVZLaPDZ2WujU4nGp0hURc2Ffr55+5bCnTRfG4XOfHkmAG0pWqB285MHtoQKBgQD+SuFVsP1mVESZTAY7jlmtDC3aSShvLNDRK/RmC9CD4yC25YSdXQIq1U7kn9pWIzCgPuu/I52kLBM2zcGAgT1znn29xTrJ+QzeeuOznh8bf8aFzGmWlhQxiUnOxu0nYp82Gd+501bBsabF75Wp0PMKKnj44zY+be31a4dIGeuD7wKBgQCco4lmJ53k979zYy9Quw6DwlacIDBjueal57WpRuit65K3St6SJ7+TsUBTr6+M9Nh9fwj4Yaca8nGFerbYSO05yoCKDh8QICuGjaU4BAzLK4VPiBlPYxO6exV5wzL14jCsjch3srKHllxzC1roji9WhMKs7UNYLLegjchNqh9/IwKBgAEw8ptHJ/i5vlSFgaX3xb3Ex9Y074aNzDCepxdvSLvFbZrNunBORjtTInp5sTkkEw89HDeaABwLxM9F6XkjodkPzgD8kojtrLzCEJz/yZ+EWra3vWriKxgMT5czYVsE4EANoPmq3sYrgd99ftL70peimUx5LADg3POAXHLfBDZrAoGBAIgkN2qbake08SiX/2raef4Y7fAaphQ3Ynm2D5VGNTvcsRMwNoyvkXoLqA5Ud2866+L/g8tmDLiGGhbalosbr1v4XoofRe5dF5eGCyDJnFkFxYNfligCxAXjrsG639MIOifvv1oR7cuc61Nufh/8XLaFAzMLsOm1TBB2yq59+4wjAoGBAMCTQ7hVSgDLRP3dDy8GmXHVfv5d3k/RgjMJpM7Qkt3l48dIs4MvCZjV7qFBMHnwcw1Pk7P6JH2mACvZIBYCwaXal2cLW/n2zOyGhNCiKXoDhTwzCX0UsPrBSo198kYPYIGkfHKisRVikIw2MMJPYfKaOcas52eDPB6EhiLwbGqL";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAiE3Ds0i2DtP4aPHJ1R6ECFFxuFSmlOacwy6chSOOuGJVIh5T/4jZyha6AIRhaVcZss4wpPOPM1pqZ7YYvhs7eLCmmyj9EWOgIkQIA08pxeyYNGw6sxa98CgR5daOINR4552d+ffLVbytNYYrPufIYVYMv8ySJbdS/9LWwRlZ5yTlH0H7ltEvVod0XS8S7PDWMqBU6WnCx2wLvwkF/Mm/SEsBa9ckh5o/SQYnk1AMnV2GmJ193znDlWRJ7wKbIErm9uI0FhqrfiMthKeKwxBp6h5j44nzwDMlaM4oWovc/E8gI0bvVcOB1QH0M4RDRi/q9pmg56tnVAG09tPU6rbp9wIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://8bdnrh.natappfree.cc/ailipei_Web_exploded/return_url.jsp";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi-sandbox.dl.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

